package formbeans;

import java.util.ArrayList;
import java.util.List;

import org.mybeans.form.FormBean;

public class EntityForm extends FormBean {

	private String name;
	private String type;
	
	public String getName() {
		return name;
	}
	public String getType() {
		return type;
	}

	public void setName(String name) {
		this.name = trimAndConvert(name,"<>\"");
	}
	public void setType(String type) {
		this.type = type;
	}
	
	public List<String> checkEntityFormErrors(){
		List<String> errors = new ArrayList<String>();
		
		if (name == null || name.length() == 0){
			errors.add("Please enter entity name");
		}
		if (isEmpty(type)) {
			errors.add("Choose entity type");
		}
		
		return errors;
	}
	
	private boolean isEmpty(String str) {
		return (str == null || str.length() == 0);
	}
}
